<?php echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $direction; ?>" lang="<?php echo $language; ?>" xml:lang="<?php echo $language; ?>">
<head>
<title><?php echo "Đơn Hàng"; ?></title>
<base href="<?php echo $base; ?>" />
<link rel="stylesheet" type="text/css" href="view/stylesheet/invoice.css" />
</head>
<body>
<?php foreach ($orders as $order) { ?>
<div style="page-break-after: always;">
  <h1><?php echo "Đơn Hàng"; ?></h1>
  <div class="div1">
    <table width="100%">
      <tr>
        <td><b>Tên cửa hàng:</b> <?php echo $order['store_name']; ?><br />
          <b>Địa chỉ:</b> <?php echo $order['address']; ?><br />
          <b><?php echo $text_telephone; ?>:</b> <?php echo $order['telephone']; ?><br />
          <b>Địa chỉ E-mail:</b> <?php echo $order['email']; ?><br />
          <b>Website:</b> <?php echo $order['store_url']; ?></td>
        <td align="right" valign="top"><table>
            <tr>
              <td><b><?php echo $text_date_added; ?></b></td>
              <td><?php echo $order['date_added']; ?></td>
            </tr>
            <?php if ($order['invoice_id']) { ?>
            <tr>
              <td><b><?php echo $text_invoice_id; ?></b></td>
              <td><?php echo $order['invoice_id']; ?></td>
            </tr>
            <?php } ?>
            <tr>
              <td><b><?php echo $text_order_id; ?></b></td>
              <td><?php echo $order['order_id']; ?></td>
            </tr>
          </table></td>
      </tr>
    </table>
  </div>
  <table class="address">
    <tr class="heading">
      <td width="50%"><b><?php echo "Thông tin người mua"; ?></b></td>
      <td width="50%"><b><?php echo "Thông tin chuyển hàng"; ?></b></td>
    </tr>
    <tr>
      <td>
        <b>Họ tên: </b><?php echo $order['customer_name']; ?><br/>
        <b>Email: </b><?php echo $order['customer_email']; ?><br/>
        <?php if(isset($order['customer_telephone'])){?>
        <b>Điện Thoại: </b><?php echo $order['customer_telephone']; ?><br/>
        <?php }?>
        <?php if(isset($order['customer_mobile'])){?>
        <b>Di Động: </b><?php echo $order['customer_mobile']; ?><br/>
        <?php }?>
        <?php if(isset($order['customer_mobile'])){?>
        <b>Địa chỉ: </b><?php echo $order['address_2']; ?><br/>
        <?php }?>                
      </td>
      <td>
        <b>Địa chỉ giao hàng: </b><?php echo $order['address_2']; ?><br/>
        <b>Ngày giao hàng: </b><?php echo $order['shipping_time']; ?><br/>      
      </td>
    </tr>
  </table>
  <table class="product">
    <tr class="heading">
      <td><b><?php echo $column_product; ?></b></td>
      <td><b><?php echo $column_model; ?></b></td>
      <td align="right"><b><?php echo $column_quantity; ?></b></td>
      <td align="right"><b><?php echo $column_price; ?> </b></td>
      <td align="right"><b><?php echo $column_total; ?></b></td>
    </tr>
    <?php foreach ($order['product'] as $product) { ?>
    <tr>
      <td><?php echo $product['name']; ?>
        <?php foreach ($product['option'] as $option) { ?>
        <br />
        &nbsp;<small> - <?php echo $option['name']; ?> <?php echo $option['value']; ?></small>
        <?php } ?></td>
      <td><?php echo $product['model']; ?></td>
      <td align="right"><?php echo $product['quantity']; ?></td>
      <td align="right"><?php echo substr(substr($product['price'],2),0,-3); ?> VNĐ</td>
      <td align="right"><?php echo substr(substr($product['total'],2),0,-3); ?> VNĐ</td>
    </tr>
    <?php } ?>

    <tr>
      <td align="right" colspan="4"><b><?php echo "Tổng giá trị:"; ?></b></td>
      <td align="right"><?php echo substr(substr($order['total'][0]['text'],2),0,-3); ?> VNĐ</td>
    </tr>

  </table>
  <table class="product">
    <tr class="heading">
      <td><b><?php echo "Yêu cầu khác"; ?></b></td>
    </tr>
    <tr>
      <td><?php echo $order['comment']; ?></td>
    </tr>
  </table>
</div>
<?php } ?>
</body>
</html>